
import React, {PropTypes} from "react";
import {
  View,
  Text,
  Image,
} from "react-native";
import Carousel from "react-native-looped-carousel";

const propTypes = {
  imageStyle: PropTypes.object,
  imageArray: PropTypes.array,
}


const CustomCarousel = ({
  imageStyle,
  imageArray,
}) => {
  const carouselImages = imageArray.map((item) => (
    <Image 
      key={item.url}
      resizeMode="stretch" 
      source={item.url}
      style={{width: gScreen.width, height: gScreen.width/2,}} 
    />
  ))
  return (
    <Carousel
      delay={2000}
      style={{width: gScreen.width, height: gScreen.width/2,}}
      autoplay
      bullets={true}
      bulletStyle={{top: 8}}
      chosenBulletStyle={{top: 8}}
    >
       {carouselImages}
    </Carousel>
  )
}

CustomCarousel.propTypes = propTypes;
CustomCarousel.defaultProps = {
  imageArray: [{url: require("../../imgs/health.jpg"),},],
}

export default CustomCarousel;